import QtQuick 2.15
import QtQuick.Controls 2.15
import QtGraphicalEffects 1.0

Item {
    property alias source: img.source
    Image {
        id: img
//        source: UserHelper.userinfo.avatar
        sourceSize: Qt.size(parent.width, parent.height)
        asynchronous: true
//        cache: false
        smooth: true
        visible: false
    }
    Image {
        id: imgDef
        source: 'qrc:/images/default.png'
        sourceSize: Qt.size(parent.width, parent.height)
        smooth: true
        visible: false
    }

    Rectangle{
        id:mask
        anchors.fill: parent
        radius: width/2.
        visible: false
    }

    OpacityMask {
        anchors.fill: parent
        source:img.status === Image.Ready? img:imgDef//img
        maskSource: mask
    }
}
